Note
Go to the end to download the full example code.
3D Nonlinear beam-column elements Gravity load analysis followed by transient analysis¶
Reinforced concrete one-bay, three-story frame Distributed vertical load on girder
Example Objectives:
3D building with rigid diaphragms Nonlinear beam-column ops.elements Gravity load analysis followed by transient analysis
Units: kips, in, sec
Examples code see OpenSees Example5.1.py
Start of model generation¶
import numpy as np
import openseespy.opensees as ops
import utils._RCsection as RCsection # local module for RC section properties
import opstool
import opstool.vis.plotly as opsvis
# remove existing model
ops.wipe()
# create ModelBuilder (with three-dimensions and 6 DOF/node)
ops.model("BasicBuilder", "-ndm", 3, "-ndf", 6)
# set default units
ops.defaultUnits("-force", "kip", "-length", "in", "-time", "sec", "-temp", "F")
Define geometry¶
# Set parameters for model geometry
h = 144.0 # Story height
by = 240.0 # Bay width in Y-direction
bx = 240.0 # Bay width in X-direction
# Create nodes
# tag X Y Z
ops.node(1, -bx / 2.0, by / 2.0, 0.0)
ops.node(2, bx / 2.0, by / 2.0, 0.0)
ops.node(3, bx / 2.0, -by / 2.0, 0.0)
ops.node(4, -bx / 2.0, -by / 2.0, 0.0)
ops.node(5, -bx / 2.0, by / 2.0, h)
ops.node(6, bx / 2.0, by / 2.0, h)
ops.node(7, bx / 2.0, -by / 2.0, h)
ops.node(8, -bx / 2.0, -by / 2.0, h)
ops.node(10, -bx / 2.0, by / 2.0, 2.0 * h)
ops.node(11, bx / 2.0, by / 2.0, 2.0 * h)
ops.node(12, bx / 2.0, -by / 2.0, 2.0 * h)
ops.node(13, -bx / 2.0, -by / 2.0, 2.0 * h)
ops.node(15, -bx / 2.0, by / 2.0, 3.0 * h)
ops.node(16, bx / 2.0, by / 2.0, 3.0 * h)
ops.node(17, bx / 2.0, -by / 2.0, 3.0 * h)
ops.node(18, -bx / 2.0, -by / 2.0, 3.0 * h)
# Retained nodes for rigid diaphragm
# tag X Y Z
ops.node(9, 0.0, 0.0, h)
ops.node(14, 0.0, 0.0, 2.0 * h)
ops.node(19, 0.0, 0.0, 3.0 * h)
# Set base constraints
# tag DX DY DZ RX RY RZ
ops.fix(1, 1, 1, 1, 1, 1, 1)
ops.fix(2, 1, 1, 1, 1, 1, 1)
ops.fix(3, 1, 1, 1, 1, 1, 1)
ops.fix(4, 1, 1, 1, 1, 1, 1)
# Define rigid diaphragm multi-point constraints
# normalDir retained constrained
ops.rigidDiaphragm(3, 9, 5, 6, 7, 8)
ops.rigidDiaphragm(3, 14, 10, 11, 12, 13)
ops.rigidDiaphragm(3, 19, 15, 16, 17, 18)
# Constraints for rigid diaphragm retained nodes
# tag DX DY DZ RX RY RZ
ops.fix(9, 0, 0, 1, 1, 1, 0)
ops.fix(14, 0, 0, 1, 1, 1, 0)
ops.fix(19, 0, 0, 1, 1, 1, 0)
Define materials for nonlinear columns¶
CONCRETE
fc = 4.0
Ec = 57000.0 * np.sqrt(fc * 1000.0) / 1000.0
# Core concrete (confined)
# tag f'c epsc0 f'cu epscu
ops.uniaxialMaterial("Concrete01", 1, -5.0, -0.005, -3.5, -0.02)
# Cover concrete (unconfined)
# tag f'c epsc0 f'cu epscu
ops.uniaxialMaterial("Concrete01", 2, -fc, -0.002, 0.0, -0.006)
# STEEL
fy = 60.0 # Yield stress
Es = 30000.0 # Young's modulus
# Reinforcing steel
# tag fy E0 b
ops.uniaxialMaterial("Steel01", 3, fy, Es, 0.02)
# Column parameters
h = 18.0
GJ = 1.0e10
colSec = 1
# Call the RCsection procedure to generate the column section
# id h b cover core cover steel nBars barArea nfCoreY nfCoreZ nfCoverY nfCoverZ GJ
RCsection.create(colSec, h, h, 2.5, 1, 2, 3, 3, 0.79, 8, 8, 10, 10, GJ)
Define column ops.elements¶
PDelta = "OFF"
# PDelta = "ON"
# Geometric transformation for columns
if PDelta == "OFF":
ops.geomTransf("Linear", 1, 1.0, 0.0, 0.0)
else:
ops.geomTransf("PDelta", 1, 1.0, 0.0, 0.0)
# Number of column integration points (sections)
np = 4
ops.beamIntegration("Lobatto", colSec, colSec, np)
# Create the nonlinear column elements
eleType = "forceBeamColumn"
# tag ndI ndJ transfTag integrationTag
ops.element(eleType, 1, 1, 5, 1, colSec)
ops.element(eleType, 2, 2, 6, 1, colSec)
ops.element(eleType, 3, 3, 7, 1, colSec)
ops.element(eleType, 4, 4, 8, 1, colSec)
ops.element(eleType, 5, 5, 10, 1, colSec)
ops.element(eleType, 6, 6, 11, 1, colSec)
ops.element(eleType, 7, 7, 12, 1, colSec)
ops.element(eleType, 8, 8, 13, 1, colSec)
ops.element(eleType, 9, 10, 15, 1, colSec)
ops.element(eleType, 10, 11, 16, 1, colSec)
ops.element(eleType, 11, 12, 17, 1, colSec)
ops.element(eleType, 12, 13, 18, 1, colSec)
# Define beam ops.elements
# --------------------------
# Define material properties for elastic beams
# Using beam depth of 24 and width of 18
Abeam = 18.0 * 24.0
# "Cracked" second moments of area
Ibeamzz = 0.5 * 1.0 / 12.0 * 18.0 * pow(24.0, 3)
Ibeamyy = 0.5 * 1.0 / 12.0 * 24.0 * pow(18.0, 3)
beamSec = 2
# Define elastic section for beams
# tag E A Iz Iy G J
ops.section("Elastic", beamSec, Ec, Abeam, Ibeamzz, Ibeamyy, GJ, 1.0)
# Geometric transformation for beams
ops.geomTransf("Linear", 2, 1.0, 1.0, 0.0)
# Number of beam integration points (sections)
np = 3
ops.beamIntegration("Lobatto", beamSec, beamSec, np)
# Create the beam ops.elements
eleType = "forceBeamColumn"
# tag ndI ndJ transfTag integrationTag
ops.element(eleType, 13, 5, 6, 2, beamSec)
ops.element(eleType, 14, 6, 7, 2, beamSec)
ops.element(eleType, 15, 7, 8, 2, beamSec)
ops.element(eleType, 16, 8, 5, 2, beamSec)
ops.element(eleType, 17, 10, 11, 2, beamSec)
ops.element(eleType, 18, 11, 12, 2, beamSec)
ops.element(eleType, 19, 12, 13, 2, beamSec)
ops.element(eleType, 20, 13, 10, 2, beamSec)
ops.element(eleType, 21, 15, 16, 2, beamSec)
ops.element(eleType, 22, 16, 17, 2, beamSec)
ops.element(eleType, 23, 17, 18, 2, beamSec)
ops.element(eleType, 24, 18, 15, 2, beamSec)
Define gravity loads¶
# Gravity load applied at each corner node
# 10% of column capacity
p = 0.1 * fc * h * h
g = 386.09
# Mass lumped at retained nodes
m = (4.0 * p) / g
# Rotary inertia of floor about retained node
i = m * (bx * bx + by * by) / 12.0
# Set mass at the retained nodes
# tag MX MY MZ RX RY RZ
ops.mass(9, m, m, 0.0, 0.0, 0.0, i)
ops.mass(14, m, m, 0.0, 0.0, 0.0, i)
ops.mass(19, m, m, 0.0, 0.0, 0.0, i)
# Define gravity loads
# create a Constant TimeSeries
ops.timeSeries("Constant", 1)
# create a Plain load pattern
ops.pattern("Plain", 1, 1, "-fact", 1.0)
for i in [5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18]:
ops.load(i, 0.0, 0.0, -p, 0.0, 0.0, 0.0)
fig = opsvis.plot_model(show_nodal_loads=True)
fig
fig = opsvis.plot_eigen(mode_tags=[1, 4], subplots=False)
fig
OPSTOOL :: Eigen data has been saved to G:\opstool\docs\.opstool.output/EigenData-Auto.zarr!
Dynamic Loads¶
# set rayleigh damping factors
ops.rayleigh(0.0, 0.0, 0.0, 0.0018)
# Define earthquake excitation
# ----------------------------
dt = 0.02
# Set up the acceleration records for Tabas fault normal and fault parallel
ops.timeSeries("Path", 2, "-filePath", "utils/tabasFN.txt", "-dt", dt, "-factor", g)
ops.timeSeries("Path", 3, "-filePath", "utils/tabasFP.txt", "-dt", dt, "-factor", g)
# Define the excitation using the Tabas ground motion records
# tag dir accel series args
ops.pattern("UniformExcitation", 2, 1, "-accel", 2)
ops.pattern("UniformExcitation", 3, 2, "-accel", 3)
Smart Analysis¶
# create the system of equation
ops.system("UmfPack")
# create the DOF numberer
ops.numberer("Plain")
# create the constraint handler
ops.constraints("Transformation")
# create the convergence test
ops.test("EnergyIncr", 1.0e-8, 20)
# create the solution algorithm, a Newton-Raphson algorithm
ops.algorithm("Newton")
# create the integration scheme, the Newmark with gamma=0.5 and beta=0.25
ops.integrator("Newmark", 0.5, 0.25)
# create the analysis object
ops.analysis("Transient")
ODB = opstool.post.CreateODB(odb_tag=1) # Create ODB object
analysis = opstool.anlys.SmartAnalyze(
"Transient",
tryAddTestTimes=True, # add test times to the analysis
testIterTimesMore=[50, 100],
tryAlterAlgoTypes=True, # try different algorithms
algoTypes=[40, 10, 20, 30], # algorithm types to try
minStep=1e-6, # minimum step size for substepping
debugMode=True, # False for progress bar, True for debug info
)
segs = analysis.transient_split(npts=2000) # Tell the analysis how to split the steps, and how many steps to take
for _ in segs:
analysis.TransientAnalyze(dt=0.01)
ODB.fetch_response_step() # fetch response for the current step
ODB.save_response() # save response to ODB
analysis.close() # Close the analysis object
>>> ✳️ OPSTOOL::SmartAnalyze:: Setting algorithm to KrylovNewton ...
>>> ✅ OPSTOOL::SmartAnalyze:: progress 1.000 %. Time consumption: 0.031 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 2.000 %. Time consumption: 0.063 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 3.000 %. Time consumption: 0.095 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 4.000 %. Time consumption: 0.142 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 5.000 %. Time consumption: 0.174 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 6.000 %. Time consumption: 0.206 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 7.000 %. Time consumption: 0.253 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 8.000 %. Time consumption: 0.284 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 9.000 %. Time consumption: 0.316 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 10.000 %. Time consumption: 0.347 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 11.000 %. Time consumption: 0.379 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 12.000 %. Time consumption: 0.411 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 13.000 %. Time consumption: 0.444 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 14.000 %. Time consumption: 0.491 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 15.000 %. Time consumption: 0.529 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 16.000 %. Time consumption: 0.570 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 17.000 %. Time consumption: 0.612 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 18.000 %. Time consumption: 0.654 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 19.000 %. Time consumption: 0.685 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 20.000 %. Time consumption: 0.727 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 21.000 %. Time consumption: 0.759 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 22.000 %. Time consumption: 0.791 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 23.000 %. Time consumption: 0.841 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 24.000 %. Time consumption: 0.887 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 25.000 %. Time consumption: 0.934 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 26.000 %. Time consumption: 0.966 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 27.000 %. Time consumption: 1.014 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 28.000 %. Time consumption: 1.062 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 29.000 %. Time consumption: 1.110 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 30.000 %. Time consumption: 1.142 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 31.000 %. Time consumption: 1.189 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 32.000 %. Time consumption: 1.237 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 33.000 %. Time consumption: 1.268 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 34.000 %. Time consumption: 1.312 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 35.000 %. Time consumption: 1.348 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 36.000 %. Time consumption: 1.395 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 37.000 %. Time consumption: 1.435 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 38.000 %. Time consumption: 1.474 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 39.000 %. Time consumption: 1.507 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 40.000 %. Time consumption: 1.542 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 41.000 %. Time consumption: 1.589 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 42.000 %. Time consumption: 1.623 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 43.000 %. Time consumption: 1.668 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 44.000 %. Time consumption: 1.716 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 45.000 %. Time consumption: 1.748 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 46.000 %. Time consumption: 1.795 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 47.000 %. Time consumption: 1.827 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 48.000 %. Time consumption: 1.874 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 49.000 %. Time consumption: 1.907 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 50.000 %. Time consumption: 1.938 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 51.000 %. Time consumption: 1.987 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 52.000 %. Time consumption: 2.034 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 53.000 %. Time consumption: 2.066 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 54.000 %. Time consumption: 2.121 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 55.000 %. Time consumption: 2.161 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 56.000 %. Time consumption: 2.209 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 57.000 %. Time consumption: 2.248 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 58.000 %. Time consumption: 2.288 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 59.000 %. Time consumption: 2.336 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 60.000 %. Time consumption: 2.372 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 61.000 %. Time consumption: 2.415 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 62.000 %. Time consumption: 2.457 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 63.000 %. Time consumption: 2.498 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 64.000 %. Time consumption: 2.529 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 65.000 %. Time consumption: 2.574 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 66.000 %. Time consumption: 2.616 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 67.000 %. Time consumption: 2.653 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 68.000 %. Time consumption: 2.700 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 69.000 %. Time consumption: 2.732 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 70.000 %. Time consumption: 2.779 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 71.000 %. Time consumption: 2.821 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 72.000 %. Time consumption: 2.858 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 73.000 %. Time consumption: 2.890 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 74.000 %. Time consumption: 2.937 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 75.000 %. Time consumption: 2.979 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 76.000 %. Time consumption: 3.016 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 77.000 %. Time consumption: 3.058 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 78.000 %. Time consumption: 3.096 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 79.000 %. Time consumption: 3.127 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 80.000 %. Time consumption: 3.175 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 81.000 %. Time consumption: 3.206 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 82.000 %. Time consumption: 3.254 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 83.000 %. Time consumption: 3.286 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 84.000 %. Time consumption: 3.334 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 85.000 %. Time consumption: 3.373 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 86.000 %. Time consumption: 3.413 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 87.000 %. Time consumption: 3.445 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 88.000 %. Time consumption: 3.477 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 89.000 %. Time consumption: 3.529 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 90.000 %. Time consumption: 3.567 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 91.000 %. Time consumption: 3.603 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 92.000 %. Time consumption: 3.635 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 93.000 %. Time consumption: 3.685 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 94.000 %. Time consumption: 3.716 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 95.000 %. Time consumption: 3.748 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 96.000 %. Time consumption: 3.794 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 97.000 %. Time consumption: 3.826 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 98.000 %. Time consumption: 3.873 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 99.000 %. Time consumption: 3.904 s.
>>> ✅ OPSTOOL::SmartAnalyze:: progress 100.000 %. Time consumption: 3.951 s.
>>> 🎉 OPSTOOL::SmartAnalyze:: Successfully finished! Time consumption: 3.951 s. 🎉
OPSTOOL :: All responses data with _odb_tag = 1 saved in G:\opstool\docs\.opstool.output/RespStepData-1.zarr!
Post-processing¶
nodal_resp = opstool.post.get_nodal_responses(odb_tag=1)
nodal_resp
OPSTOOL :: Loading all response data from G:\opstool\docs\.opstool.output/RespStepData-1.zarr ...
frame_resp = opstool.post.get_element_responses(odb_tag=1, ele_type="Frame")
frame_resp
OPSTOOL :: Loading Frame response data from G:\opstool\docs\.opstool.output/RespStepData-1.zarr ...
opsvis.set_plot_props(point_size=3.0)
opsvis.set_plot_colors(frame="gray")
fig = opsvis.plot_frame_responses(
odb_tag=1,
slides=False,
step="absMax",
resp_type="sectionDeformations",
resp_dof="My",
unit_symbol="N·m",
scale=3.0,
show_values=True, # hover to show values
line_width=5,
show_bc=True,
bc_scale=2,
style="surface",
opacity=1.0,
)
# fig.show() # for auto
# fig.write_html("sectionDeformations.html", full_html=False, include_plotlyjs="cdn")
fig
OPSTOOL :: Loading response data from G:\opstool\docs\.opstool.output/RespStepData-1.zarr ...
framerate = int(2000 / 20) # Set framerate for animation, 2000 steps, 20 seconds
fig = opsvis.plot_nodal_responses_animation(
odb_tag=1,
framerate=framerate,
resp_type="disp",
resp_dof=["UX", "UY", "UZ"],
defo_scale=10,
unit_symbol="in",
show_bc=True,
bc_scale=5,
)
# fig.show()
# fig.write_html("nodal_responses_animation.html", full_html=False, include_plotlyjs="cdn")
fig
OPSTOOL :: Loading response data from G:\opstool\docs\.opstool.output/RespStepData-1.zarr ...